<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>invalid</title>
    <style>
        input[type="text"]:invalid{
            background: red;
        }
        input[type='text']:valid{
            background: green;
        }
    </style>
</head>
<body>
<label for="text">123</label>
<input id="text" type="text" required>
</body>
</html>
